package com.linsen.erp.admin.provider.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

//部门类型
@Getter
@AllArgsConstructor
public enum DeptTypeEnum {
    HEAD(1,"总部"),
    AREA(2,"区域"),
    COMPANY(3,"公司"),
    DEPT(4,"部门"),
    ;

    @JsonValue
    private final Integer value;
    private final String desc;

    private static final Map<Integer, DeptTypeEnum> VALUES = new HashMap<>();

    static {
        for (final DeptTypeEnum deptTypeEnum : DeptTypeEnum.values()) {
            DeptTypeEnum.VALUES.put(deptTypeEnum.getValue(), deptTypeEnum);
        }
    }

    @JsonCreator
    public static DeptTypeEnum getByValue(Integer value) {
        return DeptTypeEnum.VALUES.get(value);
    }
}
